package com.ruoyi.depot.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 库存入库日志表
 * @TableName tb_inbound_stock
 */
@TableName(value ="tb_inbound_stock")
@Data
public class InboundStock implements Serializable {
    /**
     * 主键，自增
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 产品sku
     */
    @TableField(value = "sku")
    private String sku;

    /**
     * 仓库id
     */
    @TableField(value = "warehouse_id")
    private Integer warehouseId;

    /**
     * 采购订单编号（可选）
     */
    @TableField(value = "purchase_order_id")
    private Long purchaseOrderId;

    /**
     * 批次号
     */
    @TableField(value = "batch_number")
    private String batchNumber;

    /**
     * 入库数量
     */
    @TableField(value = "quantity")
    private Integer quantity;

    /**
     * 单价
     */
    @TableField(value = "unit_cost")
    private BigDecimal unitCost;

    /**
     * 总成本（数量 * 单价）
     */
    @TableField(update = "false")
    private BigDecimal totalCost;

    /**
     * 入库时间
     */
    @TableField(value = "received_date")
    private Date receivedDate;

    /**
     * 剩余库存数量
     */
    @TableField(value = "remaining_quantity")
    private Integer remainingQuantity;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        InboundStock other = (InboundStock) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSku() == null ? other.getSku() == null : this.getSku().equals(other.getSku()))
            && (this.getWarehouseId() == null ? other.getWarehouseId() == null : this.getWarehouseId().equals(other.getWarehouseId()))
            && (this.getPurchaseOrderId() == null ? other.getPurchaseOrderId() == null : this.getPurchaseOrderId().equals(other.getPurchaseOrderId()))
            && (this.getBatchNumber() == null ? other.getBatchNumber() == null : this.getBatchNumber().equals(other.getBatchNumber()))
            && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
            && (this.getUnitCost() == null ? other.getUnitCost() == null : this.getUnitCost().equals(other.getUnitCost()))
            && (this.getTotalCost() == null ? other.getTotalCost() == null : this.getTotalCost().equals(other.getTotalCost()))
            && (this.getReceivedDate() == null ? other.getReceivedDate() == null : this.getReceivedDate().equals(other.getReceivedDate()))
            && (this.getRemainingQuantity() == null ? other.getRemainingQuantity() == null : this.getRemainingQuantity().equals(other.getRemainingQuantity()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSku() == null) ? 0 : getSku().hashCode());
        result = prime * result + ((getWarehouseId() == null) ? 0 : getWarehouseId().hashCode());
        result = prime * result + ((getPurchaseOrderId() == null) ? 0 : getPurchaseOrderId().hashCode());
        result = prime * result + ((getBatchNumber() == null) ? 0 : getBatchNumber().hashCode());
        result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
        result = prime * result + ((getUnitCost() == null) ? 0 : getUnitCost().hashCode());
        result = prime * result + ((getTotalCost() == null) ? 0 : getTotalCost().hashCode());
        result = prime * result + ((getReceivedDate() == null) ? 0 : getReceivedDate().hashCode());
        result = prime * result + ((getRemainingQuantity() == null) ? 0 : getRemainingQuantity().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", sku=").append(sku);
        sb.append(", warehouseId=").append(warehouseId);
        sb.append(", purchaseOrderId=").append(purchaseOrderId);
        sb.append(", batchNumber=").append(batchNumber);
        sb.append(", quantity=").append(quantity);
        sb.append(", unitCost=").append(unitCost);
        sb.append(", totalCost=").append(totalCost);
        sb.append(", receivedDate=").append(receivedDate);
        sb.append(", remainingQuantity=").append(remainingQuantity);
        sb.append(", remark=").append(remark);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}